﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Downloader;
using System.Net;

namespace Test
{
    public partial class Form1 : Form
    {
        private DownManager manager;
        public Form1()
        {
            manager = new DownManager(Application.StartupPath);
            manager.Progress += progress;
            InitializeComponent();

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            manager.AddDownload(textBox1.Text);
            manager.InitDownloads();
        }

        private void progress(object sender, DownloadProgressChangedEventArgs e)
        {
            progressBar1.Value = e.ProgressPercentage;
        }

        private void complete(object sender, AsyncCompletedEventArgs e)
        {
            progressBar1.Value = 100;
        }

        private void start(object sender)
        {
            progressBar1.Minimum = 1;
            progressBar1.Minimum = 100;
            progressBar1.Value = 1;
        }
    }
}
